using System;
using System.Data;
using PointOfSale.Global;
using PointOfSale.Class;

namespace PointOfSale.Class
{
	public class clsService
	{
		private int serviceId;
		private string servicename;
		private int dichvuId;

		#region Properties
		public int ServiceID
		{
			get
			{
				return serviceId;
			}
			set
			{
				serviceId = value;
			}
		}
		public int DichVuID
		{
			get
			{
				return dichvuId;
			}
			set
			{
				dichvuId = value;
			}
		}
		public string ServiceName
		{
			get
			{
				return servicename;
			}
			set
			{
				servicename = value;
			}
		}
		#endregion

		public clsService()
		{
			
		}
		public static DataTable GetAllServices()
		{
			string strSelect = "SELECT dichVuId_HMS, serviceName FROM tblService ORDER BY ServiceName";
			return clsDatabase.GetDataToTable(strSelect, clsGlobal.g_DataConn);
		}
		public static DataTable GetAllServiceIds()
		{
			string strSelect = "SELECT ServiceId FROM tblService";
			return clsDatabase.GetDataToTable(strSelect, clsGlobal.g_DataConn);
		}
		public static string GetServiceName(int serviceId)
		{
			string serviceName = "";
			string selectCommand = "select serviceName from tblService where dichVuId_HMS = " + serviceId;
			DataTable dt = clsDatabase.GetDataToTable(selectCommand, clsGlobal.g_DataConn);
			if(dt.Rows.Count != 0)
			{
				serviceName = Convert.ToString(dt.Rows[0]["serviceName"]);
			}
			return serviceName;
		}
	}
}
